import { cloudOrderRequest, orderRequest } from '@/utils/HttpRequest';

export async function findByPageOrderList(params?: any) {
  //SwaggerResources

  return orderRequest.getList<API.LoginLog>('findByPageList', params);
}

export async function findByOrderDetailList(orderId?: number) {
  //SwaggerResources
  return orderRequest.get<API.LoginLog>('findByOrderDetailList', {
    orderId: orderId,
  });
}

export async function cancelOrder(orderId?: number) {
  return orderRequest.post<API.BaseResult>('cancelOrder', { orderId: orderId });
}

export async function shipments(orderId?: number, postNum?: string) {
  return orderRequest.post<API.BaseResult>('shipments', {
    orderId: orderId,
    postNum: postNum,
  });
}

export async function shenhePayment(orderId?: number, datas?: any[]) {
  return orderRequest.post<API.BaseResult>('shenhePayment', {
    orderId: orderId,
    datas: datas,
  });
}

export async function adminPayment(orderId?: number) {
  return orderRequest.post<API.BaseResult>('adminPayment?orderId='+orderId,{orderId:orderId});
}

export async function cloudDeliveryPayment(orderId?: number) {
  return orderRequest<API.BaseResult>('cloudDelivery', {
    method: 'POST',
    params: { orderId: orderId },
  });
}

export async function findByPageConsignerOrderList(params?: any) {
  //SwaggerResources

  return cloudOrderRequest.getList<API.LoginLog>('findByPageList', params);
}

export async function findByOrderConsignerDetailList(orderId?: number) {
  //SwaggerResources

  return cloudOrderRequest.getList<API.LoginLog>('findByOrderDetailList');
}

export async function cancelConsignerOrder(orderId?: number) {
  return cloudOrderRequest.get<API.BaseResult>('cancelOrder');
}

export async function adminConsignerPayment(orderId?: number) {
  return cloudOrderRequest.get<API.BaseResult>('adminPayment');
}

export async function shipmentsConsigner(orderId?: number, postNum?: string) {
  return cloudOrderRequest.get<API.BaseResult>('shipments');
}

export async function cloudEdit(params?: any) {
  return cloudOrderRequest.post<API.BaseResult>('edit', params);
}

export async function createBackOrder(params?: any) {
  return orderRequest.get<API.BaseResult>('createBackOrder', params);
}
